package cn.bugstack.springframework;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Bean工厂
 * @author oyz
 */
public class BeanFactory {
    private Map<String,BeanDefinition> map = new ConcurrentHashMap<>();


    public Object getBean(String beanName){
        return map.get(beanName).getBean();
    }

    /**
     * 注册bean
     */
    public void registerBeanDefinition(String beanName,BeanDefinition beanDefinition){
        map.put(beanName,beanDefinition);
    }
}
